﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECCIT.Data;
using System.Data;

using ECCIT.Business.Model;
using OgilvyOne.UKNow.Model;

namespace OgilvyOne.UKNow.DAL
{
   public class CnEnMappingDAL
    {
        public CnEnMappingMod GetCnEnMod(int langID,int eventID)
        {
            string cmd="";
            #region
            if (langID==2052)
	     {
		  cmd = string.Format("select * from uknow_lang_mapping where col_data_type=1 and col_data_id_cn={0}",eventID.ToString());
	     }
           
         else   
         {
             cmd = String.Format("select * from uknow_lang_mapping where col_data_type=1  and col_data_id_en={0}",eventID.ToString());
         }
            #endregion
            #region
            if (cmd != "")
            {
               
               DataSet ds=  DBHelper.ExecuteDataSet(cmd, null);
                if (ds!=null)
                {
                    CnEnMappingMod cem = new CnEnMappingMod();
                    DataTable dt = ds.Tables[0];
                    foreach (DataRow dr in dt.Rows)
                    {
                        cem.Col_data_id_cn = Convert.ToInt32(dr["COL_DATA_ID_CN"]);
                        cem.Col_data_id_en = Convert.ToInt32(dr["COL_DATA_ID_EN"]);

                    }
                    return cem;

                     
                }
                else 
                {
                    return null;
                }
            }
            else 
            {
                return null;
            }
            #endregion


        }
    }
}
